array reduce associative array php

64

array reduce associative array php -

$assoc_arr = array_reduce($arr, function ($result, $item) {
    $result[$item['text']] = $item['id'];
    return $result;
}, array());

Comments

Submit
0 Comments